package com.tear.language.node;

import java.util.Map;

import net.sf.json.JSONObject;

/**
事务操作，一个业务的根节点
属性如下
name表示业务名称
*/
public class TransactionNode extends BaseNode {

	@Override
	public boolean parse(Map<String, Object> currParams,Map<String, Object> globalParams, JSONObject obj) throws Exception {
		return true;
	}

	@Override
	public void pre(Map<String, Object> currParams,
			Map<String, Object> globalParams, JSONObject obj) throws Exception {
//		boolean transactional = MapUtils.getBooleanValue(globalParams, Attrs.TRANSACTIONAL);
//		if(!transactional) {
//			globalParams.put(Attrs.TRANSACTIONAL, true);
//		}
	}

	@Override
	public void after(Map<String, Object> currParams,
			Map<String, Object> globalParams, JSONObject obj) throws Exception {
//		boolean transactional = MapUtils.getBooleanValue(globalParams, Attrs.TRANSACTIONAL);
//		boolean rollback_flag = MapUtils.getBooleanValue(globalParams, Attrs.ROLLBACK_FLAG);
//		if(transactional && !rollback_flag) {
//			Executor executor = (Executor)globalParams.get(Attrs.EXECUTOR);
//			if(executor != null) {
//				executor.commit();
//			}
//			globalParams.put(Attrs.TRANSACTIONAL, false);
//		}
	}
	
}
